package org.teremail.smtp;

import java.util.Collection;
import java.util.List;

import org.teremail.message.Address;

/**
 * The SMTPSession is a facade that encapulates access to the 
 * networking layer, as well as any state management that needs to occur
 * within the networking layer.
 * 
 * @author Michael Barker
 *
 */
public interface SMTPSession {

    /**
     * Write some data back to the client.
     * @param message
     */
    void write(String message);

    /**
     * Get the current server's host name.
     * 
     * @return
     */
    String getHostName();

    /**
     * Get a list of the server's current capabilities.
     * 
     * @return
     */
    List<String> getCapabilities();

    /**
     * Close the connection to the client.
     * @param closeMessage 
     * 
     */
    void close(String closeMessage);

    /**
     * Set the current sender address.
     * 
     * @param address
     */
    void setSender(Address address);

    /**
     * Gets the current sender address.
     * @return
     */
    Address getSender();
    
    /**
     * Any input mail data should be discarded.
     * 
     */
    void clearData();

    /**
     * Set that all incoming bytes should be treated as email input until the
     * final marker is recieved.
     * 
     * @param b
     */
    void setDataMode(boolean b);
    
    //boolean isDataMode();

    /**
     * Add a recipient to the list of current recipients.
     * 
     * @param address
     */
    void addRecipient(Address address);

    /**
     * Get the current set of recipients.
     * 
     * @return
     */
    Collection<Address> getRecipients();

    /**
     * Clear the current set of recipients.
     * 
     */
    void clearRecipients();


}
